package top.huiwow.entity;

import com.c45y.Bastille.BastilleEntity;
import com.c45y.Bastille.Entities.BastilleWither;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
import top.huiwow.GameCore;
import top.huiwow.listeners.EntityListener;
import top.huiwow.managers.GamePlayer;
import top.huiwow.utils.Validates;

import java.util.Collections;

public class Nicron extends AkaishiEntity {
    int internalID;


    @NotNull
    @Override
    public Class<BastilleWither> getEntityType() {
        return BastilleWither.class;
    }

    @NotNull
    @Override
    public EntityStats getStats(int level) {
        return new EntityStats(Collections.singletonList(new ItemStack(Material.NETHER_STAR, 2)), level * 100, level * 100, "Nicron", true);
    }

    @Override
    public int getInternalID() {
        return internalID;
    }

    @Override
    public void setInternalID(int i) {
        internalID = i;
    }

    @Override
    public BastilleEntity getTheEntity(Location location, int level) {
        BastilleEntity origin=super.getTheEntity(location,level);
        origin.emtpyGoals().emtpyTargets();
        return origin;

    }

    @Override
    public void spawn(Location location, int level) {

        //radius:5,amount:5.
        int radius=10;
        int amount=20;
        for (int i=0;i<amount;i++){
            double angle=Math.random()*Math.PI*2;
            double xOff=Math.cos(angle)*radius;
            double zOff=Math.sin(angle)*radius;
            Location spawnLoc=location.clone().add(xOff,0,zOff);
            GameCore.getInstance().getEntityManager().spawnEntity(spawnLoc,GameCore.getInstance().getEntityManager().getInternalID(Negromancer.class),10);
        }
        super.spawn(location, level);
    }
}